public class demo01 {
    //卡片
    public static void main(String[] args) {
        int[] arr=new int[10];
        for (int i = 0; i < arr.length; i++) {
            arr[i]=2021;
        }
        int num=1;
        int flag=0;
        while (true){
            int tmp=num;
            while (tmp!=0) {
                if(arr[tmp%10]-1!=0) {
                    arr[tmp % 10]--;
                }else{
                    flag=1;
                    break;
                }
                tmp /= 10;
            }
            if(flag==1){
                System.out.println(num);
                break;
            }
            num++;
        }
    }
}
